<?php
/** 
  * @desc this file position effect board_config file some config, $config['public_html'],etc.
  *
  */
define("XHPROF_ENABLE", 1);
if (XHPROF_ENABLE)
{
    xhprof_enable(XHPROF_FLAGS_CPU + XHPROF_FLAGS_MEMORY);
}

date_default_timezone_set("Asia/Shanghai");

$ds = DIRECTORY_SEPARATOR; 
require_once(dirname(dirname(__FILE__)).$ds."include".$ds."global.inc.php");
//run application
require_once(dirname(dirname(dirname(__FILE__))).$ds."system".$ds."core".$ds."application.php");
NICED_Application::init();

NICED_Application::execute();

NICED_TIME_START("call_service");//call_service is namespace for log time elapse
NICED_TIME_STOP ("call_service", "before_curl");//before_curl is stop namespace in call_service namespace
NICED_TIME_STOP ("call_service", "before_socket");//before_socket is stop namespace in call_service na

NICED_MEMORY_START("php");
NICED_MEMORY_STOP("php");
NICED_MEMORY_STOP("php", "default");

NICED_TRACE("abc");
NICED_TRACE("efg");

if (XHPROF_ENABLE)
{
    $data = xhprof_disable();   //返回运行数据

    // xhprof_lib在下载的包里存在这个目录,记得将目录包含到运行的php代码中
    include_once "/home/yanli/www/xhprof-0.9.3/xhprof_lib/utils/xhprof_lib.php";  
    include_once "/home/yanli/www/xhprof-0.9.3/xhprof_lib/utils/xhprof_runs.php";  

    $objXhprofRun = new XHProfRuns_Default(); 

    // 第一个参数j是xhprof_disable()函数返回的运行信息
    // 第二个参数是自定义的命名空间字符串(任意字符串),
    // 返回运行ID,用这个ID查看相关的运行结果
    $run_id = $objXhprofRun->save_run($data, "xhprof_".time());
}
